package com.sping_boot3.spirng_boot3.juc;

import lombok.SneakyThrows;

import java.util.concurrent.CountDownLatch;

public class CountDownLatch_demo {
    @SneakyThrows
    public static void main(String[] args) {
        CountDownLatch latch = new CountDownLatch(6);
        for (int i = 0; i < 6; i++) {
            int finalI = i;
            new Thread(() ->{
                System.out.println(finalI);
                latch.countDown();
            },String.valueOf(i)).start();
        }
        latch.await();
        System.out.println("--------------");
    }
}
